﻿// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. 
// See License.txt in the project root for license information.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace System.Threading.Actors
{
    // An abstraction of an actor proxy, returned by IActorState.GetActorProxy()
    public interface IActorProxy
    {
        // Call a method on the actor
        void Command(string methodName, object[] parameters); // fire-and-forget
        IActorPromise Request(string methodName, object[] parameters); // allow for return value handling

        // Support adding code to a newly created actor
        bool AddAssembly(string assemblyName, byte[] assemblyBytes);

        // Obtain an observable to which you can subscribe for events
        IActorStateObservable this[string eventType] {get;}
    }

    // Since we needed our Subscribe method to accept a (string) eventHandlerName, rather
    // than an IObserver, we had to make our own slightly tweaked observable interface.
    public interface IActorStateObservable
    {
        IDisposable Subscribe(string eventHandlerName);
        void Unsubscribe(string eventHandlerName);
    }
}
